/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com */

/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef TRI_EXT_ITEMLIST_H_
#define TRI_EXT_ITEMLIST_H_

#include <iostream>
#include <vector>
#include <string>
#include <map>

//Include library header
#include "panel.h"
#include "button.h"

namespace tri {
namespace ui {

class extItemList : public tri::ui::extPanel,public sigslot::has_slots<sigslot::multi_threaded_local>{
public:
	extItemList();
	virtual ~extItemList();
	
	virtual void setStyle(std::string style);
	void pack();
	virtual void update();
	void addItem(std::string item,std::string icon ="");
	void removeItem(std::string item);
	int index(std::string item);
	int size();
	void clear();
	std::string getSelectedItem();
	void setIconSize(float);
	void setItemHeight(float);
	
private:
	std::vector<tri::ui::extButton*> mButtons;
	std::vector<tri::ui::extPanel*> mIcons;
	std::vector<std::string> mItems;
	std::vector<std::string> mItemIcons;
	std::string mSelected;
	float mIconSize;
	float mItemHeight;
	
	bool hasItem(std::string item);
	void addButton();
	void onButtonClicked(std::string target);
};

}
}

#endif
